﻿using System;
using System.IO;

namespace Terraria.ModLoader.Audio
{
	// Token: 0x02000277 RID: 631
	public class MusicData
	{
		// Token: 0x060019F3 RID: 6643 RVA: 0x000125E4 File Offset: 0x000107E4
		public MusicData(string cachePath)
		{
			this.cachePath = cachePath;
		}

		// Token: 0x060019F4 RID: 6644 RVA: 0x000125F3 File Offset: 0x000107F3
		public MusicData(byte[] data, bool mp3)
		{
			this.data = data;
			this.mp3 = mp3;
		}

		// Token: 0x060019F5 RID: 6645 RVA: 0x0042712C File Offset: 0x0042532C
		public Music GetInstance()
		{
			if (this.cachePath != null)
			{
				if (this.mp3)
				{
					throw new Exception("Cache and MP3 not implemented");
				}
				return new MusicStreamingWAV(this.cachePath);
			}
			else
			{
				if (this.data == null)
				{
					throw new Exception("Error, MusicWrapper neither cache nor data supplied.");
				}
				if (this.mp3)
				{
					return new MusicStreamingMP3(this.data);
				}
				return new MusicStreamingWAV(new MemoryStream(this.data));
			}
		}

		// Token: 0x04001750 RID: 5968
		private string cachePath;

		// Token: 0x04001751 RID: 5969
		private byte[] data;

		// Token: 0x04001752 RID: 5970
		private bool mp3;
	}
}
